﻿using SR_ScanBar;

namespace DLL.NET.WEB.Static.ScanBar
{
    public class CWeb_ScanBar
    {
        private WebServiceChargeSoapClient client = new WebServiceChargeSoapClient(WebServiceChargeSoapClient.EndpointConfiguration.WebServiceChargeSoap);

        public int PIVASaveStatus(string barCode, string jobNum)
        {
            //http://www.webxml.com.cn/WebServices/TranslatorWebService.asmx?wsdl
            //soap.getEnCnTwoWayTranslatorAsync("hello");
            try
            {
                #region 方法1

                //调用具体的方法，这里是 HelloWorldAsync 方法
                Task<PIVASaveStatusResponse> responseTask = client.PIVASaveStatusAsync(barCode, jobNum);
                //获取结果
                PIVASaveStatusResponse response = responseTask.Result;

                return response.Body.PIVASaveStatusResult;

                #endregion 方法1
            }
            catch (Exception e)
            {
                return -1;
            }
        }

        public int PIVATakeOutOfStorage(string barCode, string jobNum)
        {
            try
            {
                #region 方法1

                //调用具体的方法，这里是 HelloWorldAsync 方法
                Task<PIVATakeOutOfStorageResponse> responseTask = client.PIVATakeOutOfStorageAsync(barCode, jobNum);
                //获取结果
                PIVATakeOutOfStorageResponse response = responseTask.Result;

                return response.Body.PIVATakeOutOfStorageResult;

                #endregion 方法1
            }
            catch (Exception e)
            {
                return -1;
            }
        }
    }
}